package com.ruoyi.web.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/system/sitedetection")
public class SitedetectionController {
    @PostMapping("/getitem")
    @ResponseBody
    public  AjaxResult getType(@RequestParam("Url") String Url) {//获取网址类型
        String Res = "";
        String url = "https://safeweb.norton.com/report/show?url=" + Url;
        try {
            Document document = Jsoup.connect(url).get();
            Elements element = document.getElementsByTag("b");
            System.out.println(element.toString().substring(3, element.toString().length() - 4));
            Res=element.toString().substring(3, element.toString().length() - 4);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return AjaxResult.success(Res);
    }
}
